<template>
    <div class="contact_page">
        <div class="maxWidth1400 usInfo">
            <h3>CONTACT US</h3>
            <h4 v-if="locale !== 'en'">{{ $t("contact.text3") }}</h4>
            <div class="flex justify-between items-end">
                <div class="usInfo_text">
                    <ul>
                        <li>
                            <img
                                src="/assets/image/address.png"
                                alt="address"
                            />
                            <div>
                                <p>{{ $t("contact.text4") }}</p>
                                <p>
                                    {{ state.info?.address }}
                                </p>
                            </div>
                        </li>
                        <li>
                            <img src="/assets/image/phone.png" alt="phone" />
                            <div>
                                <p>{{ $t("contact.text2") }}</p>
                                <p>{{ state.info?.phone }}</p>
                            </div>
                        </li>
                        <li>
                            <img src="/assets/image/email.png" alt="email" />
                            <div>
                                <p>{{ $t("contact.text1") }}</p>
                                <p>{{ state.info?.email }}</p>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="usInfo_img">
                    <CustomImage :srcUrl="state.info?.imgUrl" />
                </div>
            </div>
        </div>
        <div class="online_message">
            <div
                class="online_title"
                v-aos.once="['animate__fadeInUp']"
                data-aos-delay="0.5s"
                data-aos-duration="1s"
            >
                <h3>{{ $t("contact.text5") }}</h3>
                <p>
                    {{ $t("contact.text13") }}
                </p>
            </div>
            <div class="online_form maxWidth1400">
                <div
                    class="flex long"
                    v-aos.once="['animate__fadeInUp']"
                    data-aos-delay="0.5s"
                    data-aos-duration="1s"
                >
                    <div class="formDiv">
                        <p>{{ $t("contact.text6") }}</p>
                        <input
                            type="text"
                            name="company"
                            id="company"
                            autocomplete="off"
                        />
                    </div>
                    <div class="formDiv">
                        <p>{{ $t("contact.text7") }}</p>
                        <input
                            type="text"
                            name="Title"
                            id="Title"
                            autocomplete="off"
                        />
                    </div>
                </div>
                <div
                    class="flex long"
                    v-aos.once="['animate__fadeInUp']"
                    data-aos-delay="0.5s"
                    data-aos-duration="1s"
                >
                    <div class="formDiv">
                        <p>{{ $t("contact.text8") }}</p>
                        <input
                            type="text"
                            name="EMail"
                            id="EMail"
                            autocomplete="off"
                        />
                    </div>
                    <div class="formDiv">
                        <p>{{ $t("contact.text9") }}</p>
                        <input
                            type="text"
                            name="Tel"
                            id="Tel"
                            autocomplete="off"
                        />
                    </div>
                </div>
                <div
                    class="long"
                    v-aos.once="['animate__fadeInUp']"
                    data-aos-delay="0.5s"
                    data-aos-duration="1s"
                >
                    <p>{{ $t("contact.text10") }}</p>
                    <textarea
                        name="Intro"
                        id="Intro"
                        :placeholder="`${$t('contact.text11')}`"
                        autocomplete="off"
                    ></textarea>
                </div>
                <div
                    class="btn long"
                    v-aos.once="['animate__fadeInUp']"
                    data-aos-delay="0.5s"
                    data-aos-duration="1s"
                >
                    <button>{{ $t("contact.text12") }}</button>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
const { locale } = useI18n();

let state = reactive({
    phoneList: [],
    info: {
        address: "",
        phone: "",
        title: "",
        imgUrl: "",
        email: "",
    },
});
const getCompanyInfo = async () => {
    const res = await useGET("/v1/contactus/getInfo");
    if (res?.data) {
        const jsonData = JSON.parse(res.data);
        if (jsonData?.photo) {
            state.photoList = jsonData.photo.split(",");
        }
        state.info = { ...jsonData };
    }
};

onMounted(() => {
    getCompanyInfo();
});

watch(
    () => locale.value,
    (val) => {
        getCompanyInfo();
    }
);
</script>

<style lang="scss" scoped>
.contact_page {
    position: relative;
    overflow: hidden;
    .usInfo {
        padding: 116px 0 100px;
        h3 {
            font-size: 66px;
            font-weight: 400;
            text-transform: uppercase;
            color: #fff3c8;
            line-height: 1.14;
        }
        h4 {
            font-size: 30px;
            color: #0058ce;
        }
        .usInfo_text {
            li {
                width: 100%;
                padding: 30px 8px;
                border-bottom: 1px solid #ccc;
                display: flex;
                align-items: center;
                // flex-wrap: wrap;
                & > div {
                    padding-left: 18px;
                    p {
                        &:first-child {
                            color: #0058ce;
                        }
                        &:last-child {
                            color: #676767;
                            margin-top: 4px;
                            word-break: break-all;
                        }
                    }
                }
            }
        }
        .usInfo_img {
            overflow: hidden;
            img {
                cursor: pointer;
                transition: all 0.4s ease;
                &:hover {
                    transform: scale(1.06);
                }
            }
        }
    }

    .online_message {
        padding: 84px 0 92px;
        background: url(/assets/image/contactus_bg.jpg) no-repeat center / cover;
        .online_title {
            text-align: center;
            h3 {
                font-size: 30px;
                color: #0058ce;
                margin-bottom: 12px;
            }
            p {
                color: #666;
                font-weight: 300;
            }
        }
        .online_form {
            .long {
                width: 100%;
                text-align: center;
                margin-top: 38px;
                .formDiv {
                    width: 50%;
                    margin-right: 28px;
                    &:last-child {
                        margin-right: 0;
                    }
                }
                p {
                    height: 26px;
                    color: #000;
                    font-weight: 300;
                    font-size: 14px;
                    text-align: left;
                }
                input {
                    display: block;
                    width: 100%;
                    height: 50px;
                    padding: 0 20px;
                    font-size: 16px;
                    color: #333;
                    transition: box-shadow 0.4s ease;
                    border: none;
                    appearance: none;
                    outline: none;
                    &:focus {
                        box-shadow: 0 0 0 1px rgba(0, 88, 206, 0.5) inset;
                    }
                }
                textarea {
                    display: block;
                    width: 100%;
                    height: 145px;
                    padding: 14px 20px;
                    font-size: 16px;
                    color: #333;
                    transition: box-shadow 0.4s ease;
                    border: none;
                    appearance: none;
                    outline: none;
                    &:focus {
                        box-shadow: 0 0 0 1px rgba(0, 88, 206, 0.5) inset;
                    }
                    &::placeholder {
                        font-size: 12px;
                        font-weight: 300;
                        color: #ccc;
                    }
                }
                button {
                    width: 180px;
                    height: 50px;
                    background: #0a5fd0;
                    font-size: 14px;
                    color: #fff;
                    transition: all 0.4sease;
                    cursor: pointer;
                    margin: 0 auto;
                }
            }
        }
    }
}
</style>
